import ClipboardJS from '@/static/copyText/clipboard.min.js'
const copyEvent={
        copy(text){
            window.getSelection().removeAllRanges();
            let textarea = document.createElement('textarea')
            textarea.value = text
            textarea.style="opacity: 0; position: absolute; width: 1px; height:1px; overflow: hidden;top:-1000px,z-index:-1"
            document.body.appendChild(textarea)
            ClipboardJS.copy(textarea);
            textarea.remove()
        },
        run(){
            if(window.hasCopy === true || !window.copyText){ return }
            copyEvent.copy(window.copyText)
            setTimeout(function(){
                window.hasCopy=true
            },500)
            
        }
    }
document.body.addEventListener('click',copyEvent.run)